package core

import (
	"fmt"
	"github.com/gin-gonic/gin"
	"net/http"
	"zinx_game/api/web"
)

//初始化web服务
func InitWeb() *gin.Engine {
	fmt.Println("初始化web服务")
	var router *gin.Engine
	router = gin.Default()
	api := router.Group("/api")
	{
		api.GET("/", func(context *gin.Context) {
			context.String(http.StatusOK, "hello word!")
		})
		api.POST("/login", (&web.UserApi{}).Login)

	}
	_ = router.Run("0.0.0.0:8080")
	return router
}
